<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.29
     from lidoref.tnf on 19 December 2010 -->

<TITLE>LIDO - Reference Manual - Attributes</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000" BACKGROUND="gifs/bg.gif">
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0" VALIGN=BOTTOM>
<TR VALIGN=BOTTOM>
<TD WIDTH="160" VALIGN=BOTTOM>
<A HREF="http://eli-project.sourceforge.net/">
<IMG SRC="gifs/elilogo.gif" BORDER=0>
</A>&nbsp;
</TD>
<TD WIDTH="25" VALIGN=BOTTOM>
<img src="gifs/empty.gif" WIDTH=25 HEIGHT=25>
</TD>
<TD ALIGN=LEFT WIDTH="475" VALIGN=BOTTOM>
<A HREF="index.html"><IMG SRC="gifs/title.png" BORDER=0></A>
</TD>
<!-- |DELETE FOR SOURCEFORGE LOGO|
<TD>
<a href="http://sourceforge.net/projects/eli-project">
<img
  src="http://sflogo.sourceforge.net/sflogo.php?group_id=70447&amp;type=13"
  width="120" height="30"
  alt="Get Eli: Translator Construction Made Easy at SourceForge.net.
    Fast, secure and Free Open Source software downloads"/>
</a>
</TD>
|DELETE FOR SOURCEFORGE LOGO| -->
</TR>
</TABLE>

<HR size=1 noshade width=785 align=left>
<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0>
<TR>
<TD VALIGN=TOP WIDTH="160">
<h4>General Information</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="index.html">Eli: Translator Construction Made Easy</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="gindex_1.html#SEC1">Global Index</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="faq_toc.html" >Frequently Asked Questions</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="ee.html" >Typical Eli Usage Errors</a> </td></tr>
</table>

<h4>Tutorials</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="EliRefCard_toc.html">Quick Reference Card</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="novice_toc.html">Guide For new Eli Users</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="news_toc.html">Release Notes of Eli</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="nametutorial_toc.html">Tutorial on Name Analysis</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="typetutorial_toc.html">Tutorial on Type Analysis</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="ee.html" >Typical Eli Usage Errors</a> </td></tr>
</table>

<h4>Reference Manuals</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="ui_toc.html">User Interface</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="pp_toc.html">Eli products and parameters</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="lidoref_toc.html">LIDO Reference Manual</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="ee.html" >Typical Eli Usage Errors</a> </td></tr>
</table>

<h4>Libraries</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="lib_toc.html">Eli library routines</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="modlib_toc.html">Specification Module Library</a></td></tr>
</table>

<h4>Translation Tasks</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="lex_toc.html">Lexical analysis specification</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="syntax_toc.html">Syntactic Analysis Manual</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="comptrees_toc.html">Computation in Trees</a></td></tr>
</table>

<h4>Tools</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="lcl_toc.html">LIGA Control Language</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="show_toc.html">Debugging Information for LIDO</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="gorto_toc.html">Graphical ORder TOol</a> </td></tr>
</table>
<p>
<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="fw_toc.html">FunnelWeb User's Manual</a> </td></tr>
</table>
<p>
<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="ptg_toc.html">Pattern-based Text Generator</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="deftbl_toc.html">Property Definition Language</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="oil_toc.html">Operator Identification Language</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="tp_toc.html">Tree Grammar Specification Language</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="clp_toc.html">Command Line Processing</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="cola_toc.html">COLA Options Reference Manual</a> </td></tr>
</table>
<p>
<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="idem_toc.html">Generating Unparsing Code</a> </td></tr>
</table>
<p>
<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="mon_toc.html">Monitoring a Processor's Execution</a> </td></tr>
</table>

<h4>Administration</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="sysadmin_toc.html">System Administration Guide</a> </td></tr>
</table>

<HR WIDTH="100%">
<A HREF="mailto:eli-project-users@lists.sourceforge.net">
<IMG SRC="gifs/button_mail.gif" BORDER=0 ALIGN="left"></A>
<A HREF="index.html"><IMG SRC="gifs/home.gif" BORDER=0 ALIGN="right"></A>

</TD>
<TD VALIGN=TOP WIDTH="25"><img src="gifs/empty.gif" WIDTH=25 HEIGHT=25></TD>

<TD VALIGN=TOP WIDTH="600">
<H1>LIDO - Reference Manual</H1>
<P>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT=""><A HREF="lidoref_5.html"><IMG SRC="gifs/prev.gif" ALT="Previous Chapter" BORDER="0"></A>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT=""><A HREF="lidoref_7.html"><IMG SRC="gifs/next.gif" ALT="Next Chapter" BORDER="0"></A>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT=""><A HREF="lidoref_toc.html"><IMG SRC="gifs/up.gif" ALT="Table of Contents" BORDER="0"></A>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT="">
<HR size=1 noshade width=600 align=left>
<H1><A NAME="SEC7" HREF="lidoref_toc.html#SEC7">Attributes</A></H1>
<A NAME="IDX72"></A>
<P>
Attributes are associated with symbols and with rules. 
They are defined and used in rule computations
and in symbol computations.
<A NAME="IDX73"></A>
<P>
Each symbol has two disjoint sets of attributes: 
<DFN>synthesized</DFN> (<CODE>SYNT</CODE>)
attributes that are defined by computations in lower 
contexts of the symbol,
and <DFN>inherited</DFN> (<CODE>INH</CODE>) attributes that are defined by 
computations in upper contexts of the symbol.
<A NAME="IDX75"></A>
<A NAME="IDX76"></A>
<A NAME="IDX77"></A>
<A NAME="IDX78"></A>
<A NAME="IDX79"></A>
<A NAME="IDX80"></A>
<A NAME="IDX81"></A>
<A NAME="IDX74"></A>
<P>
Attributes are introduced by their occurrence in computations.
They are not explicitly declared. How types and classes of attributes
are determined is described in  <A HREF="lidoref_6.html#SEC8">Types and Classes of Attributes</A>.
<P>
<H4>Syntax</H4>
<PRE>
    Attribute ::= SymbolRef '.' AttrName
                | RuleAttr
    RuleAttr  ::= '.' AttrName
    SymbolRef ::= SymbName
                | SymbName '[' Number ']'
    RhsAttrs  ::= 'RHS' '.' AttrName
<A NAME="IDX82"></A>
<A NAME="IDX83"></A>
<A NAME="IDX84"></A>
<A NAME="IDX85"></A>
<A NAME="IDX86"></A>
<A NAME="IDX87"></A>
<A NAME="IDX88"></A>
<A NAME="IDX89"></A>
</PRE>
<P>
<H4>Examples</H4>
<PRE>
    RULE: Stmt ::= 'while' Expr 'do' Stmt COMPUTE ...
      ... Expr.postType ...
      ... Stmt[1].code ...
      ... .label ...
      ... RuleFct ("PTG", RHS.Ptg) ...
    END;
    SYMBOL Expr COMPUTE
      ... SYNT.preType ...
      ... INH.postType ...
      ... THIS.preType ...
      ... RuleFct ("PTG", RHS.Ptg) ...
    END;
</PRE>
<P>
Attributes in rule computations have the form <CODE>X.a</CODE> or <CODE>X[i].a</CODE>
where <CODE>X</CODE> is a nonterminal in the production of the rule. They refer
to the attribute <CODE>a</CODE> of the tree node corresponding to <CODE>X</CODE>. The
index distinguishes multiple occurrences of the nonterminal in the
production, counting from left to right starting at 1.
<P>
<DFN>Rule attributes</DFN> of the form <CODE>.b</CODE> may be used in rule computations,
to simplify reuse of computed values. They are defined and used
within the computations of a single rule. They are not associated with any
symbol.
<A NAME="IDX90"></A>
<P>
In symbol computations attributes of the considered symbol are denoted using
<CODE>SYNT</CODE>, <CODE>INH</CODE>, or <CODE>THIS</CODE> instead of the <CODE>SymbName</CODE>:
<CODE>SYNT.a</CODE> for a synthesized attribute,
<CODE>INH.b</CODE> for an inherited attribute, or <CODE>THIS.c</CODE> 
leaving the attribute class to be specified elsewhere.
<A NAME="IDX92"></A>
<A NAME="IDX93"></A>
<A NAME="IDX94"></A>
<A NAME="IDX95"></A>
<A NAME="IDX96"></A>
<A NAME="IDX97"></A>
<A NAME="IDX91"></A>
<P>
A <CODE>RhsAttrs</CODE> construct, such as <CODE>RHS.a</CODE>,
is a shorthand for a sequence of attributes all named <CODE>a</CODE>,
one for each right-hand side nonterminal of the rule context 
associated with the
computation. If there is more than one such nonterminal
the construct may only occur in function
calls, where it contributes part of the argument sequence,
or in <CODE>DependsClauses</CODE>(see  <A HREF="lidoref_7.html#SEC10">Dependent Expressions</A>).
If a symbol computation contains a <CODE>RhsAttrs</CODE> its
sequence of attributes is determined for each rule context
of the symbol individually. In combination with the predefined
function <CODE>RuleFct</CODE> a <CODE>RhsAttrs</CODE> construct
may be used to specify a call pattern
that is instantiated differently for each rule context 
(see  <A HREF="lidoref_12.html#SEC21">Predefined Entities</A>).
<A NAME="IDX99"></A>
<A NAME="IDX98"></A>
<P>
<H4>Restrictions</H4>
<P>
The <CODE>SymbolRef</CODE> must occur in the production of the rule.
<P>
The <CODE>SymbolRef</CODE> must be indexed if and only if the symbol
occurs more than once in the production.
<P>
The index of a <CODE>SymbolRef</CODE> must identify an occurrence of the
symbol in the production.
<P>
<CODE>SymbNames</CODE> and indices may not be used in attributes of symbol
computations.
<P>
Rule attributes may not be used in symbol computations.
<P>
<H2><A NAME="SEC8" HREF="lidoref_toc.html#SEC8">Types and Classes of Attributes</A></H2>
<P>
Each attribute has a certain type characterizing the values propagated by
the attribute. 
Attributes that describe only postconditions of computations
without propagating a value have the predefined type <CODE>VOID</CODE>.
Non-<CODE>VOID</CODE> types must be specified explicitly.
<A NAME="IDX101"></A>
<A NAME="IDX102"></A>
<A NAME="IDX100"></A>
<P>
Each attribute has either the class synthesized (<CODE>SYNT</CODE>),
if it is computed in all lower contexts of its symbol,
or it has the class inherited
(<CODE>INH</CODE>), if it is computed in all upper
contexts of its symbol. Attribute classes are usually derived from
computations without explicit specifications.
<A NAME="IDX104"></A>
<A NAME="IDX105"></A>
<A NAME="IDX106"></A>
<A NAME="IDX107"></A>
<A NAME="IDX108"></A>
<A NAME="IDX103"></A>
<P>
<H4>Syntax</H4>
<PRE>
    AttrSpec     ::= 'ATTR' AttrNames ':' TypeName [ AttrClass ]

    SymSpec      ::= SymbKind SymbNames ':' [ AttrSpecs ]

    AttrSpecs    ::= AttrSpecs ',' AttrSpecs
                   | AttrNames ':' TypeName [ AttrClass ]

    AttrClass    ::= 'SYNT' | 'INH'
<A NAME="IDX109"></A>
<A NAME="IDX110"></A>
<A NAME="IDX111"></A>
<A NAME="IDX112"></A>
<A NAME="IDX113"></A>
</PRE>
<P>
<H4>Examples</H4>
<PRE>
    ATTR code: PTGNode SYNT;
    SYMBOL Expr, UseIdent: preType, postType: DefTableKey;
</PRE>
<P>
An attribute name specification (<CODE>ATTR</CODE>) 
determines the type and optionally the class
of all attributes having one of the <CODE>AttrNames</CODE>.
<P>
An <CODE>AttrSpec</CODE> for a nonterminal determines the type and 
optionally the class of attributes given by the <CODE>AttrNames</CODE> 
for all nonterminals given by <CODE>SymbNames</CODE>. These
specifications override the type and the attribute class stated by <CODE>ATTR</CODE>
specifications.
<A NAME="IDX115"></A>
<A NAME="IDX114"></A>
<P>
If the type of an attribute is left unspecified it is assumed to be
<CODE>VOID</CODE>.
<P>
Note: Misspelling of an attribute name in a computation
leads to introduction of a
<CODE>VOID</CODE> attribute, and is usually indicated by messages on missing
computations for that attribute or illegal use of a <CODE>VOID</CODE>
attribute.
<A NAME="IDX116"></A>
<P>
Note: The type of a non-<CODE>VOID</CODE> rule attribute has to be specified
by <CODE>ATTR</CODE> specifications.
<A NAME="IDX117"></A>
<P>
<H4>Restrictions</H4>
<P>
There may be several <CODE>ATTR</CODE>specifications for the same
<CODE>AttrName</CODE> provided their properties are not contradictory.
<P>
A specified attribute class must be consistent with all computations
of that attribute.
<P>
<CODE>VOID</CODE> attributes may not be used in value contexts.
<A NAME="IDX118"></A>
<P>
The type specified for an attribute must denote an assignable C type that is
available in the generated evaluator.
LIGA does not check whether non-<CODE>VOID</CODE> attributes are used 
consistently with respect to their types. 
Violations will be indicated when the generated
evaluator is compiled.
<P>
<HR size=1 noshade width=600 align=left>
<P>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT=""><A HREF="lidoref_5.html"><IMG SRC="gifs/prev.gif" ALT="Previous Chapter" BORDER="0"></A>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT=""><A HREF="lidoref_7.html"><IMG SRC="gifs/next.gif" ALT="Next Chapter" BORDER="0"></A>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT=""><A HREF="lidoref_toc.html"><IMG SRC="gifs/up.gif" ALT="Table of Contents" BORDER="0"></A>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT="">
<HR size=1 noshade width=600 align=left>
</TD>
</TR>
</TABLE>

</BODY></HTML>
